package com.bdpn.ch05.filter;

import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.handler.UserRoleAuthorizationInterceptor;

public class InterceptorConfig implements WebMvcConfigurer {
    private String[] excludePathPatterns;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        String[]pathPatterns = {"/**"};
        String[]excludePathPatterns={"/login","/regist","/statics/**"};
        registry.addInterceptor(new UserRoleAuthorizationInterceptor()).addPathPatterns(pathPatterns).excludePathPatterns(excludePathPatterns);
    }
}
